package com.school.information.controller;

import com.school.information.entity.SysMenuEntity;
import com.school.information.service.SysMenuService;
import com.school.information.utils.ResultUtil;
import com.school.information.utils.UserUtil;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * (SysMenu)表控制层
 *
 * @author ycc
 * @since 2023-05-28 23:20:58
 */
@RestController
@RequestMapping("sysMenu")
public class SysMenuController {
    @Resource
    private SysMenuService menuService;

    /**
     * 获取菜单下拉树列表
     */
    @GetMapping("/treeselect")
    public ResultUtil treeselect() {
        List<SysMenuEntity> menus = menuService.selectMenuList(UserUtil.getUserId());
        return ResultUtil.success(menuService.buildMenuTreeSelect(menus));
    }
}

